package com.zw.yzk.kabu.data.repository;


import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.NotifyStatusEntity;
import com.zw.yzk.kabu.data.network.service.GetNotifyStatusService;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2016/12/24.
 */

public class GetNotifyStatus extends CommonRepository {

    @Inject
    public GetNotifyStatus() {

    }

    @Override
    protected Observable connectServer(Task task) {
        GetNotifyStatusService service = ServiceGenerator.createService(GetNotifyStatusService.class);

        return service.getNotifySwitch(task.userId, task.accessToken);
    }

    @Override
    protected Func1<NotifyStatusEntity, Observable> getServerData() {
        return new Func1<NotifyStatusEntity, Observable>() {
            @Override
            public Observable call(NotifyStatusEntity entity) {
                return Observable.just(entity);
            }
        };
    }

}
